<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include file="/WEB-INF/view/common/common.jsp" %>

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>求职者-注册</title>
		<link rel="stylesheet" href="<%=request.getContextPath() %>/vendor/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
	</head>
	<body>
		<h2 class="text-center">求职者-注册</h2>
		<hr>
		
		<div class="container">
			<form id="talent-register" class="form-horizontal" action="<%=request.getContextPath() %>/talent_talentRegister.action" method="post" data-validator-option="{timely:2}">
			<a href="${ctx }/position_listAll.action"><b>招聘首页</b></a>
				<div class="form-group">
				    <label for="code" class="col-sm-2 control-label">账号：</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" maxLength="10" name="talent.code" placeholder="请输入账号"  id="talent.code">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="name" class="col-sm-2 control-label">姓名：</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" maxLength="10" name="talent.name" placeholder="请输入姓名" data-rule="required; length(2~10)">
				    </div>
				  </div>
				 <div class="form-group">
				    <label for="password" class="col-sm-2 control-label">密码：</label>
				    <div class="col-sm-10">
				      <input type="password" class="form-control" name="talent.password" placeholder="请输入密码"  data-rule="required; password">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="phone" class="col-sm-2 control-label">手机号码：</label>
				    <div class="col-sm-10" style="float: left;">
				      <input type="text" class="form-control" maxLength="11" name="talent.phone" placeholder="请输入手机号码"  data-rule="required; tel|mobile">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="email" class="col-sm-2 control-label">电子邮箱：</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" maxLength="50" name="talent.email" placeholder="请输入电子邮箱"  data-rule="required; email; length(~50)">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="age" class="col-sm-2 control-label">年龄：</label>
				    <div class="col-sm-10">
				     	<select class="form-control" name="talent.age">
							<script>
								var age = 18;
								for (var i = 18; i <= 60; i++) {
									if (i == age) {
										document.write('<option selected>' + i + '</option>');
									} else {
										document.write('<option>' + i + '</option>');	
									}
								}
							</script>
						</select>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="gender" class="col-sm-2 control-label">性别：</label>
				    <div class="col-sm-10">
				     	<label class="radio-inline">
						  <input type="radio" name="talent.gender" value="1"> 男
						</label>
						<label class="radio-inline">
						  <input type="radio" name="talent.gender" value="2" checked="checked"> 女
						</label>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="interestPositions" class="col-sm-2 control-label">爱好：</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" maxLength="10" name="talent.interestPositions" placeholder="请输入爱好" data-rule="required; length(~10)">
				    </div>
				  </div>
				  <div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <button type="submit" class="btn btn-primary btn-block" id="submit">确认</button>
				    </div>
				  </div>
			</form>
		</div>
		<script src="<%=request.getContextPath()%>/vendor/jquery.min.js"></script>
	    <script src="<%=request.getContextPath()%>/vendor/layer/layer.js"></script>
	    <script src="<%=request.getContextPath()%>/vendor/nice-validate-1.1.2/jquery.validator.min.js?local=zh-CN"></script>
		<script>
		$('#talent-register').validator({
		    fields: {
		        'talent.code': {
		         rule:'required; length(2~10);remote(${ctx}/talent_checkTalentName.action)',
		         tip: '请输入2到10位长度的账号！',
   	        	 'true': '账号可用！',
		         dataFilter: function(data) {
		        	 if (data === 'true') {
	   		   				return '';	
	   		   			} 
	   		   			return '账号已存在';
		 	       },
		        }
		    }
		});
		   
 		</script>
	</body>
</html>